package com.ymatou.iapi.spu.service;

import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.productspu.parameter.SPUDTO;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取SPU详情
*FreeMaker Template自动生成代码
*/
public class GetSPUDetailCall extends YmatouBaseCall{
	private static String opurl ="api/Spu/GetSPUDetail";
	
	public GetSPUDetailCall() {
		super(EnvSetup.getSystemUrl("productspu_iapi"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public SPUDTO getSPU(){
		SPUDTO spu=null;
		try{
			String sspu=getJsonObject().get("Result").getAsJsonObject().get("SPU").getAsJsonObject().toString();
			spu = (SPUDTO) FormatUtil.GSONToObject(sspu,SPUDTO.class);
		}catch (Exception e) {
		}
		return spu;
		
	}
}